package wh.coach.web.controller.command;

import java.util.Optional;
import java.util.function.Consumer;

import lombok.Getter;
import lombok.Setter;

/**
 * @author hangwen
 * @date 2023/8/12
 */
@Getter
@Setter
public class PersonPatchCommand {
    private String name;
    private Integer age;

    public void patchAgeIfPresent(final Consumer<Integer> patcher) {
        Optional.ofNullable(age).ifPresent(patcher);
    }

    public void patchNameIfPresent(final Consumer<String> patcher) {
        Optional.ofNullable(name).ifPresent(patcher);
    }
}
